# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=m68k -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

---
name:            test_scalar_small
fixedStack:
  - { id: 0, type: default, offset: 4, size: 1, alignment: 4, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
  - { id: 1, type: default, offset: 0, size: 1, alignment: 8, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body:             |
  bb.1:
    ; CHECK-LABEL: name: test_scalar_small
    ; CHECK: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
    ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s8) from %fixed-stack.0, align 8)
    ; CHECK-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
    ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (s8) from %fixed-stack.1, align 4)
    ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
    ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD1]](s32)
    ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s8) = G_MUL [[TRUNC]], [[TRUNC1]]
    ; CHECK-NEXT: $bd0 = COPY [[MUL]](s8)
    ; CHECK-NEXT: RTS implicit $bd0
    %3:_(p0) = G_FRAME_INDEX %fixed-stack.1
    %2:_(s32) = G_LOAD %3(p0) :: (load (s8) from %fixed-stack.1, align 8)
    %0:_(s2) = G_TRUNC %2(s32)
    %5:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %4:_(s32) = G_LOAD %5(p0) :: (load (s8) from %fixed-stack.0, align 4)
    %1:_(s2) = G_TRUNC %4(s32)
    %6:_(s2) = G_MUL %0, %1
    %7:_(s8) = G_ANYEXT %6(s2)
    $bd0 = COPY %7(s8)
    RTS implicit $bd0

...
---
name:            test_scalar_nonpow2
fixedStack:
  - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
  - { id: 1, type: default, offset: 0, size: 4, alignment: 8, stack-id: default,
      isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body:             |
  bb.1:
    ; CHECK-LABEL: name: test_scalar_nonpow2
    ; CHECK: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
    ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 8)
    ; CHECK-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
    ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (s32) from %fixed-stack.1)
    ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LOAD]], [[LOAD1]]
    ; CHECK-NEXT: $d0 = COPY [[MUL]](s32)
    ; CHECK-NEXT: RTS implicit $d0
    %3:_(p0) = G_FRAME_INDEX %fixed-stack.1
    %2:_(s32) = G_LOAD %3(p0) :: (load (s32) from %fixed-stack.1, align 8)
    %0:_(s17) = G_TRUNC %2(s32)
    %5:_(p0) = G_FRAME_INDEX %fixed-stack.0
    %4:_(s32) = G_LOAD %5(p0) :: (load (s32) from %fixed-stack.0)
    %1:_(s17) = G_TRUNC %4(s32)
    %6:_(s17) = G_MUL %0, %1
    %7:_(s32) = G_ANYEXT %6(s17)
    $d0 = COPY %7(s32)
    RTS implicit $d0

...
